import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'base_view_model.dart';

/**
 * 基础视图
 */
class BaseView<T extends BaseViewModel> extends StatelessWidget {
  T model;
  Function(T) builder;
  BaseView({Key key,
    this.builder,
    this.model
  }):super(key: key);
  @override
  Widget build(BuildContext context) {
    return GetBuilder<T>(
        init: Get.put(model),
        builder: (model)=>builder(model)
    );
  }
}
